<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <link rel="stylesheet" href="http://www.emposha.com/demo/fcbkcomplete_2/style.css" type="text/css" media="screen" charset="utf-8" />
        <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.min.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript" src="../js/jquery.fcbkcomplete.js"></script>
        <script type="text/javascript">
            var listNN = new Array();
            $(document).ready(function(){
                $("#DynamicPropertyAR_dynamicproperty").fcbkcomplete({
                    json_url: ("index.php?r=dynamicproperty/search"),
                    addontab: true,
                    //newel:true,
                    height: 15,
                    cache: false,
                    //bricket : false,
                    firstselected : true,
                    filter_selected:true,
                    //filter_hide:false,
                    complete_text:"Type and select a set of values...",
                    onselect: function(item){
                        console.log(item);
                        addToListNN(item._value,listNN, "dynamicproperty","RecordLevelElement","save");
                    },
                    onremove: function(item){
                        addToListNN(item._value,listNN, "dynamicproperty","RecordLevelElement","delete");
                    }
                });
            });
            function addToListNN1(id,jList,controllerItem,controllerElement,action){
                if(id!=''){                    
                    var jsonItem = {
                        "id":id,
                        "action":action,
                        "controllerItem":controllerItem,
                        "controllerElement":controllerElement
                    };
                    jList.push(jsonItem);
                }
            }

            function saveSpecimen(){
                var arSpecimen;
                if(listNN.length > 0){
                    for (var i=0; i < listNN.length; i++) {
                        if(listNN[i].action!="noaction")
                            persistNN(listNN[i].id, arSpecimen.idrecordlevelelement, listNN[i].controllerItem, listNN[i].controllerElement,listNN[i].action);
                    }
                }
            }

            function persistNNaa(idItem,idElement,controllerItem,controllerElement,action){
                $.ajax({
                    type:'POST',
                    url:'index.php?r='+controllerItem+'/save'+controllerElement+"NN",
                    data: {
                        "idItem":idItem,
                        "idElement":idElement,
                        "action":action
                    },
                    success:function(data){
                    }
                });
            }

        </script>
    </head>
    <body>
        <h1>NxN demo</h1>

        </div> 
        <form action="submit.php" method="POST" accept-charset="utf-8">
            <select id="select3" name="select3">
            </select>
        </form>
    </body>

</html>
